package com.linked.order.shoppingcart.service.impl;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.linked.order.shoppingcart.bean.po.ShoppingCartInfoPO;
import com.linked.order.shoppingcart.mapper.IShoppingCartInfoMapper;
import com.linked.order.shoppingcart.service.IShoppingCartService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

/**
 * @author :dbq
 * @date : 2023/5/26 15:15
 * @description : desc
 */
@Slf4j
@Service
public class ShoppingCartServiceImpl implements IShoppingCartService {

    private final ObjectMapper mapper;

    private final IShoppingCartInfoMapper shoppingCartInfoMapper;

    public ShoppingCartServiceImpl(ObjectMapper mapper, IShoppingCartInfoMapper shoppingCartInfoMapper) {
        this.mapper = mapper;
        this.shoppingCartInfoMapper = shoppingCartInfoMapper;
    }

    @Override
    public boolean addShoppingCard(ShoppingCartInfoPO param) throws Exception {
        return shoppingCartInfoMapper.insert(param) > 0;
    }
}
